#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> temp_vec;
bool compare(pair<int, int> a, pair<int, int> b)
{
    return a.second > b.second;
}
bool compare1(pair<int, int> a, pair<int, int> b)
{
    return a.first < b.first;
}
int score()
{
    int score = 0;
    for (size_t i = 0; i < temp_vec.size(); i++)
    {
        if (temp_vec[i] >= 3)
        {
            score += 1;
        }
    }
    return score;
}
int main()
{
    int n, temp, score1, player = 1;
    vector<pair<int, int>> compete;
    cin >> n;
    for (size_t i = 0; i < n * n; i++)
    {
        cin >> temp;
        temp_vec.push_back(temp);
        if ((i + 1) % n == 0)
        {
            score1 = score();
            compete.push_back(make_pair(player, score1));
            temp_vec.clear();
            player += 1;
        }
    }
    sort(compete.begin(), compete.end(), compare); // 按照分数排序
    if (compete[0].second != compete[1].second)
    {
        cout << compete[0].first;
        return 0;
    }
    for (size_t i = 0; i < compete.size(); i++)
    {
        if (compete[0].second == compete[i].second)
        {// 一直寻找分数相等的
            continue;
        }
        else
        {
            sort(compete.begin(), compete.begin() + i, compare1);
            cout << compete[0].first;
            return 0;
        }
    }
}